*IAT SCORING ALGORITHM FROM GREENWALD, NOSEK, & BANAJI, 2003
LAST UPDATE: 03/03/04

This macro will transform a datafile with raw trial latencies (stored as one line per response) 
for a standard format IAT (7 blocks) into a one line summary per subject of the IAT effect using
GNB's new scoring algorithm.

To use this algorithm for your SAS program, perform these two steps:  
(1) Run this script.  The macro should then be loaded into SAS's active memory.  
(2) In your SAS program, enter the following statement 

%iatCalc(libIn, libOut, indata, outdata, BLOCNAME, SESHID, TRLLATNC, TRLERROR, VERROR, VEXTREME, VSD)

and replace the dummy values with the ones that correspond to your own datafiles and variable names.  


Descriptions of what the macro expects for input, and what it will output are below.  Also, at the 
bottom of this commenting section, there is a sample SAS script that would invoke this macro (assuming 
that you have already run the macro to get it into SAS's active memory).

   The macro expects the following types of libraries, datafiles, and data:
      libIn     = input SAS library name
      libOut    = output SAS library name
      indata    = filename of input SAS dataset in the input SAS library
      outdata   = filename for the output SAS dataset in the output SAS library
      BLOCNAME  = variable name for block identifier in the indata file: alphanumeric indication of the 
                  four trial blocks ('B3', 'B4', 'B6', 'B7' are critical blocks corresponding 
                  to B3, B4, B6, and B7 from GNB, 2002).  At present the macro requires that the variable 
                  passed here uses the names 'B3', 'B4', 'B6', 'B7' to refer to the B3-B7 blocks
	  SESHID    = variable name for unique subject identifier in the indata file
	  TRLLATNC  = variable name for latency of response for trial in the indata file
	  TRLERROR  = variable name for error coding: 0 if initial response was correct, 1 if initial response 
                  was incorrect in the indata file
      VERROR    = value: if '1' the algorithm will use error trial latencies, if '2' the algorithm will replace 
                  error trial latencies with blockmean+600
      VEXTREME  = value: if '1' the algorithm provides no treatment of extreme values, if '2' the algorithm
                  will delete trials <400ms
      VSTD      = value: if '1' the block standard deviation is performed including corrected error trials,
                  if '2' the block standard deviation is performed on correct responses only (1 is standard)

   The macro will output the following variables to the outdata file:
      SESHID  = unique subject identifier
      SUBEXCL = 0 for inclusion data, 1 for excluded data, 2 for incomplete data
      MB3     = mean of trial latencies for B3
      MB4     = mean of trial latencies for B4
      MB6     = mean of trial latencies for B6
      MB7     = mean of trial latencies for B7
      CS1     = standard deviation for B3 and B6 trials combined (correct trials only)
      CS2     = standard deviation for B4 and B7 trials combined (correct trials only)
      AS1     = standard deviation for B3 and B6 trials combined (all trials)
      AS2     = standard deviation for B4 and B7 trials combined (all trials)
      EB3     = percent errors of trials for B3
      EB4     = percent errors of trials for B4
      EB6     = percent errors of trials for B6
      EB7     = percent errors of trials for B7
      FB3     = percent fast responses of trials for B3
      FB4     = percent fast responses of trials for B4
      FB6     = percent fast responses of trials for B6
      FB7     = percent fast responses of trials for B7
      DIFF1   = MB6 - MB3
      DIFF2   = MB7 - MB4
      IAT1    = DIFF1/STD1
      IAT2    = DIFF2/STD2
	  IAT     = mean of IAT1 and IAT2
;

/* SAMPLE SAS SCRIPT THAT USES THIS MACRO ASSUMING THAT IT IS IN ACTIVE SAS MEMORY
This sample script opens two libraries called 'web' and 'outdata'. In the 'web' library a SAS file 
named 'iatrace350000' already exists and will be pulled into active memory by the macro.  When the macro 
finishes it will output the result data into a file in the library 'outdata' called 'Ciatrace350000'. The 
information coding the name of the block is in the variable BLOCK (which is passed to 'BLOCNAME' for
the algorithm). The information coding subject ID is SUB (passed to 'SESHID').  The information coding
the latency of each trial is in LATENCY (passed to TRLLATNC).  The information coding whether an error
was made on each trial is in ERROR (passed to TRLERROR).  And, the setting '2' for VERROR means that 
error latencies will be replaced with the blockmean+600.  The setting '2' for VEXTREME means that responses
faster than 400ms will be deleted before calculating the IAT effect. The setting '1' for VSTD means that 
the standard deviations will be calculated after recombining error trials so the range of D values is bounded 
between (-2,2).  When the algorithm finishes and saves the output, the proc means statement will calculate a 
mean of the IAT effects across subjects (after excluding 'bad' subjects).

libname web 'H:\raceatt\';
libname outdata 'H:\raceattclean\';
%iatCalc(web, outdata, iatrace350000, Ciatrace350000, BLOCK, SUB, LATENCY, ERROR, 2, 2,1);
proc means (data=outdata.Ciatrace350000);var IAT;where SUBEXCL=0;run;
*/

/*MACROS for NEW IMPLICIT ASSOCIATION TEST SCORING ALGORITHM (Greenwald, Nosek, & Banaji, 2002)*/
%macro iatCalc(libIn, libOut, indata, outdata, BLOCNAME, SESHID, TRLLATNC, TRLERROR, VERROR, VEXTREME, VSTD);
%let divide= /; %let multiply= *; %let add = +; %let subtract = -;
%iatAlgorithm(libIn=&libIn, libOut=&libOut, indata=&indata, outdata=&outdata, BLOCNAME=&BLOCNAME, 
              SESHID=&SESHID, TRLLATNC=&TRLLATNC, TRLERROR=&TRLERROR, VERROR=&VERROR, VEXTREME=&VEXTREME, VSTD=&VSTD);run;
%mend iatCalc;

%macro iatAlgorithm(libIn, libOut, indata, outdata, BLOCNAME, SESHID, TRLLATNC, TRLERROR, VERROR, VEXTREME, VSTD);
data IAT; set &libIn..&indata; 
%*PRELIMINARY STEPS FOR HANDLING WEBDATA FORMATS;
    keep &BLOCNAME &SESHID &TRLLATNC &TRLERROR;
proc sort data=iat; by &SESHID &BLOCNAME;	
	%*options nonotes; %*suppress all Notes to log;	

data IAT; set IAT;

%*STEP 1: Include data from B3, B4, B6, B7;
   if &BLOCNAME in ('B3', 'B4', 'B6', 'B7') then ;
   else delete;

%*STEP 2a: Eliminate trial latencies > 10,000ms;
   if &TRLLATNC > 10000 then delete;

%*STEP 2b: Eliminate subjects for whom more than 10% of trials have latencies < 300ms;
   else if &TRLLATNC < 0 then delete; %*for miscoded data in datafile indicating negative response times;
   else if -1 < &TRLLATNC < 300 then FAST = 1;
   else FAST = 0;

data FASTDATA; set IAT; keep &SESHID &BLOCNAME FAST;
proc sort; by &SESHID &BLOCNAME;
proc means data=IAT noprint; by &SESHID &BLOCNAME; var FAST; output out=means mean=MEAN;
proc transpose data=means prefix=F name=name out=FASTMEAN; by &SESHID; id &BLOCNAME;
data FASTMEAN; set FASTMEAN; where name='MEAN'; FASTM = mean(FB3, FB4, FB6, FB7);
   if FASTM > .10 then SUBEXCL = 1; else SUBEXCL = 0; 
   %*SUBEXCL = 0 (include data), 1 (exclude data - too many fast responses), 2 (exclude data - missing data);
   %*The SUBEXCL variable needed to be reintroduced to the final dataset in STEP 12;

%*STEP 3: Use all trials;
   %*in the conventional algorithm the first two trials of each block would be dropped here;

%*STEP 4: No extreme value treatment <or> delete trial with latencies <400ms;
data IAT; set IAT; 
    %*if &VEXTREME = 1 then do nothing here;
    if &VEXTREME = 2 then do; if &TRLLATNC < 400 then delete; end;

proc sort data=IAT; by &SESHID &BLOCNAME;

%*STEP 5: Compute mean of correct latencies for each block;
data CORR; set IAT;
   %*if &VERROR is 1 then means and SDs will be calculated for the entire set of latencies;
   if &VERROR = 2 then do; if &TRLERROR NE 0 then delete; end;
   keep &SESHID &BLOCNAME &TRLLATNC &TRLERROR;
proc means data=CORR noprint; by &SESHID &BLOCNAME; var &TRLLATNC; output out=means mean=MEAN;
proc transpose data=means prefix=M name=name out=CORRMEAN; by &SESHID; id &BLOCNAME;
data CORRMEAN; set CORRMEAN; where name='MEAN';

%*STEP 6a: Compute pooled SD for B3 & B6, and separately for B4 & B7 for correct trials only;
data SD; set CORR;
   if &TRLERROR NE 0 then delete;  *drop error trials;
   if &BLOCNAME in ('B3', 'B6') then TD = '1';
   else if &BLOCNAME in ('B4', 'B7') then TD = '2';
   else delete;
   drop &BLOCNAME;
proc sort data=SD; by &SESHID TD;
proc means data=SD noprint; by &SESHID TD; var &TRLLATNC; output out=means std=STD;
proc transpose data=means prefix=CS name=name out=CORRSTD2; by &SESHID; id TD;
data CORRSTD2; set CORRSTD2; where name='STD';

%*STEP 6b: Compute pooled SD for B3 & B6, and separately for B4 & B7 including error trials;
data SD; merge IAT CORRMEAN; by &SESHID;
   if &TRLERROR < 0 then delete;
   else if &TRLERROR > 1 then delete; %*get rid of coding errors;
   else if &TRLERROR = 1 and &VERROR = 2 then do;
      if &BLOCNAME in ('B3') then &TRLLATNC = MB3 + 600;
	  else if &BLOCNAME in ('B4') then &TRLLATNC = MB4 + 600;
	  else if &BLOCNAME in ('B6') then &TRLLATNC = MB6 + 600;
	  else if &BLOCNAME in ('B7') then &TRLLATNC = MB7 + 600;
   end;
   if &BLOCNAME in ('B3', 'B6') then TD = '1';
   else if &BLOCNAME in ('B4', 'B7') then TD = '2';
   else delete;
   drop &BLOCNAME;
proc sort data=SD; by &SESHID TD;
proc means data=SD noprint; by &SESHID TD; var &TRLLATNC; output out=means std=STD;
proc transpose data=means prefix=AS name=name out=CORRSTD1; by &SESHID; id TD;
data CORRSTD1; set CORRSTD1; where name='STD';

%*STEP 7: Replace error latencies with block mean + 600ms 
<or> use latency from stimulus onset to correct response (when correct response is required);
data ERR; set IAT;
   keep &SESHID &BLOCNAME &TRLERROR;
   if &TRLERROR < 0 then delete;
   else if &TRLERROR > 1 then delete; %*get rid of coding errors;
proc means data=ERR noprint; by &SESHID &BLOCNAME; var &TRLERROR; output out=means mean=MEAN;
proc transpose data=means prefix=E name=name out=ERRMEAN; by &SESHID; id &BLOCNAME;
data ERRMEAN; set ERRMEAN; where name='MEAN';

%*STEP 7 continued: combining data;
data COMBINE; merge CORRMEAN CORRSTD1 CORRSTD2 ERRMEAN FASTMEAN; by &SESHID; %*combining datasets for calculating final means;
   if &VERROR=2 then do;
      array BLOCKMeans(*) MB: ;
      array BLOCKCstds(*) CS: ;
	  array BLOCKAstds(*) AS: ;
      array BLOCKErrs(*) EB: ;
      do i=1 to dim(BLOCKMeans); %*for each of the four blocks replace error trials with mean + 600ms;
	     BLOCKMeans{i} = (1-BLOCKErrs{i})*BLOCKMeans{i} + (BLOCKErrs{i})*(BLOCKMeans{i}+600);			
      end;
   end;

%*STEP 8: No transformation of latencies;
    %*in the conventional algorithm, raw latencies would be log transformed prior to the transposing in the current format;

%*STEP 9: Average latencies for each of the four blocks;
    %*this step was already accomplished in the do loop above;

%*STEP 10: Compute two differences B6-B3 and B7-B4 (does not account for pairing order);
   DIFF1 = MB6 - MB3;
   DIFF2 = MB7 - MB4;

%*STEP 11: Divide each difference by associated pooled SD from STEP 6a or 6b;
   If &VSTD = 2 then do;
      IAT1 = DIFF1/CS1;
      IAT2 = DIFF2/CS2;
   end;
   else do; %*IF VSTD = 1 also set as default;
      IAT1 = DIFF1/AS1;
	  IAT2 = DIFF2/AS2;
   end; 

%*STEP 12: Average quotients from STEP 11;
   IAT = mean(IAT1, IAT2);

%*if there is missing data, do mark data as excluded (SUBEXCL=2);
   do i=1 to dim(BLOCKMeans);
      if BLOCKMeans{i} = . then SUBEXCL = 2;
   end;
data &libout..&outdata (drop=i name);
	set COMBINE;
run;
%mend iatAlgorithm;
*END OF ALGORITHM;

LIBNAME web_in 'C:\SAS data\Study2b_In'; 
LIBNAME web_out 'C:\SAS data\Study2b_Out';
LIBNAME race 'C:\SAS data\Study2b_Out\race';

DATA web_in.explicit; 
   	INFORMAT Questionnaire_Name $20.;
	INFORMAT Question_Name $18.;
	INFORMAT Study_Name $50.; 
   	INFILE 'C:\SAS data\Brock4_In\explicit.txt'  
                 DELIMITER='09'x FIRSTOBS=2; 
   	INPUT Task_Number Question_Number Questionnaire_Name $ Question_Name $ Question_Response $ Attempt Study_Name $ Session_ID;  
 /*  DROP Study_Name; */ 
PROC CONTENTS;
RUN; 
 

 DATA web_in.demo; 
  	INFORMAT Characteristic $20.;
	INFORMAT Study_Name $50.;
	INFORMAT value $25.; 
  	INFILE 'C:\SAS data\Brock4_In\demographics.txt' DELIMITER='09'x FIRSTOBS=2; 
  	INPUT Characteristic $ Value $ User_ID Study_Name $; 
 /*  DROP Study_Name;  */
PROC CONTENTS;
RUN; 
 
   
DATA web_in.sessions; 
	INFORMAT Study_Name $50.;
	INFORMAT Session_Date $8.;
	INFORMAT Creation_Date $30.;
	INFORMAT Last_Update_Date $30.;  
   	INFILE 'C:\SAS data\Brock4_In\sessions.txt'  
         DELIMITER='09'x  FIRSTOBS=2; 
   	INPUT Session_ID User_ID Study_Name $ Session_Date $ Session_Status $ Creation_Date Last_Update_Date; 
PROC CONTENTS;
RUN; 
  
  
DATA web_in.implicit; 
   	INFORMAT Block_Pairing_Definition $40.;
	INFORMAT Study_Name $25.;
	INFORMAT Task_Name $37.;
	INFORMAT Trial_Name $15.;
	INFORMAT Trial_Response $15.;  
   	INFILE 'C:\SAS data\Brock4_In\iat2.txt'  
         DELIMITER='09'x FIRSTOBS=2; 
   	INPUT block_number block_name $ block_trial_count block_pairing_definition $ study_name $ task_number task_name $ 
          trial_number trial_name $ trial_response $ trial_latency trial_error session_id;
	DROP study_name; /*DROP Study_Name*/  
PROC CONTENTS;
RUN; 


DATA web_in.sessiontasks; 
	INFORMAT Study_Name $50.;               
	INFORMAT Session_Last_Update_Date $21.; 
	INFORMAT Session_Creation_Date $21.; 
    INFORMAT Task_ID $20.;                  
	INFORMAT Task_Creation_Date $21.;         
	INFORMAT Session_Date $21.;  
    INFORMAT Task_URL $128.;                
	INFORMAT User_Agent $16.;                          
	INFORMAT Session_Created_By $24.; 
 	INFILE 'C:\SAS data\Brock4_In\sessionTasks.txt' DELIMITER='09'x LRECL=2000 FIRSTOBS  =  2; 
  	INPUT  Session_ID Task_Number Task_ID $ Task_URL $ User_Agent $ Study_URL $ Task_Status $ Task_Sequence $ Task_Creation_Date 
           $ User_ID Study_Name $ Session_Date $ Session_Status $ Session_Creation_Date $ Session_Created_By $ Session_Last_Update_Date $; 
PROC CONTENTS;
RUN;        
  

/************************************************/
/*                                              */
/*        		Setting IAT Data Up 		    */
/*                                              */
/************************************************/

DATA temp; SET web_in.implicit; 
IF BLOCK_NAME in ('BLOCK0', 'BLOCK1', 'BLOCK4') then delete;
IF TRIAL_ERROR = '0' THEN TRIALERROR = 0;
ELSE IF TRIAL_ERROR = '1' THEN TRIALERROR = 1;
KEEP trial_number block_name session_ID block_pairing_definition trial_latency trialerror task_name;
RUN;

PROC SORT DATA=temp;
BY session_id task_name block_name trial_number;
RUN;

DATA temp; SET temp;
repeat = 0;
IF session_ID = lag(session_id) and TASK_NAME= lag(TASK_NAME) AND BLOCK_NAME = lag(BLOCK_NAME) AND TRIAL_NUMBER = lag(TRIAL_NUMBER) 
THEN repeat=1; *if prior row is same as current row, mark as a repeat;

PROC SORT; 
BY session_ID; 
RUN;

PROC FREQ; 
TABLES repeat; 
RUN; 

DATA temp; SET temp;
IF repeat = 1 THEN DELETE; 
DROP repeat; 
RUN; *drop duplicate lines of data;



/************************************************/
/*                                              */
/*        SORTING THROUGH THE IAT              */
/*                                              */
/************************************************/
DATA reordered; SET temp;
IF task_name in ("demo_raceb") THEN DO;
IF BLOCK_NAME in ('BLOCK2') THEN BLOCK = 'B6';
	ELSE IF BLOCK_NAME in ('BLOCK3') THEN BLOCK = 'B7';
	ELSE IF BLOCK_NAME in ('BLOCK5') THEN BLOCK = 'B3';
	ELSE IF BLOCK_NAME in ('BLOCK6') THEN BLOCK = 'B4';
END;
ELSE IF task_name in ("demo_racea") THEN DO;
	IF BLOCK_NAME in ('BLOCK2') THEN BLOCK = 'B3';
	ELSE IF BLOCK_NAME in ('BLOCK3') THEN BLOCK = 'B4';
	ELSE IF BLOCK_NAME in ('BLOCK5') THEN BLOCK = 'B6';
	ELSE IF BLOCK_NAME in ('BLOCK6') THEN BLOCK = 'B7';
END;
RUN;



/*************************************************/
/* RACE IAT (Higher scores indicate pro-white) */
/*************************************************/
DATA web_in.race_iat; SET reordered;
WHERE task_name IN ("demo_racea", "demo_raceb");
DROP BLOCK_NAME;
run;

%iatCalc(web_in, race, race_iat, race_iat_clean, BLOCK, SESSION_ID, TRIAL_LATENCY, TRIALERROR, 1, 2, 1); 

DATA race.input; SET web_in.race_iat;   *pull up the raw dataset for use and keep only the necessary variables;
KEEP trial_number BLOCK block_pairing_definition session_id task_name trialerror trial_latency;

PROC SORT; 
BY session_ID BLOCK;  *sort by session and block so transpose function will work below;
RUN;

/*identifying block pairing definitions*/
DATA race.pairing; SET race.input; 
WHERE TRIAL_NUMBER = 1; 
KEEP session_ID BLOCK block_pairing_definition;

PROC TRANSPOSE DATA=race.pairing PREFIX=P NAME=name OUT=race.pairing; 
BY session_ID; 
VAR block_pairing_definition;
ID BLOCK;

PROC SORT DATA=race.PAIRING; 
BY SESSION_ID; 
RUN; *outputs a file with session_id and the block_pairing_defs for all blocks;

/*n per block - including extreme outliers;	vars=nBLOCK0, nBLOCK, ... ; set=ns*/
DATA race.ns; SET race.input; KEEP SESSION_ID BLOCK TRIAL_NUMBER;
PROC MEANS DATA=race.ns noprint; BY SESSION_ID BLOCK; VAR TRIAL_NUMBER; OUTPUT OUT=race.means n=N; 
PROC TRANSPOSE DATA=race.means PREFIX=N NAME=name OUT=race.spdmeans; BY SESSION_ID; ID BLOCK;
PROC SORT DATA=race.spdmeans; BY SESSION_ID;
DATA race.ns; SET race.spdmeans; WHERE name='N';
RUN; *outputs a file with the number of actual trials in each block;

/************************************************/
/*                                              */
/*        DIFFERENTATING THE CONDITIONS         */
/*                                              */
/************************************************/

DATA temp2; SET web_in.sessiontasks; 

PROC SORT; 
BY session_ID task_number task_url;

DATA temp2; SET temp2;
     DROP user_ID task_ID; 
     repeat=0;
	 task_url = tranwrd(task_url,"//user/jenniferjoy/brockfollowup/","");
	 task_url = tranwrd(task_url,"/user/brock/","");

     if SESSION_ID = lag(SESSION_ID) and TASK_NUMBER = lag(TASK_NUMBER)
        and TASK_URL = lag(TASK_URL) then repeat=1;
/*
proc means; class repeat; var session_id;run;*/

data temp2; set temp2;
    if repeat = 1 then delete;  *dropping repeat data;
	if kindex(TASK_URL,"iat") then do; TASK_URL = "IAT"; end;
  	else if kindex(TASK_URL,"debriefing") then do; TASK_URL = "DEBRIEF"; end;
  	else if kindex(TASK_URL,"concepts") then do; TASK_URL = "CONCEPTS"; end; 
  	else if kindex(TASK_URL,"explicit") then do; TASK_URL = "EXPLICIT"; end;
proc sort data=temp2; by session_id;
proc transpose data=temp2 name=name out=taskID prefix=task; by SESSION_ID; var TASK_URL;id TASK_NUMBER; 
proc transpose data=temp2 name=name out=timeID prefix=time; by SESSION_ID; var TASK_CREATION_DATE;id TASK_NUMBER;
proc sort data=taskID; by session_id; proc sort data=timeID; by session_id;
data temp2; merge taskID timeID; by session_ID; drop _LABEL_ name;
run;

data web_out.sessioninfo; set temp2;
if task3 IN (' floweririsb.html', ' floweririsa.html', ' flowerhibiscusb.html', ' flowerhibiscusa.html', ' flowersunflowera.html', ' flowersunflowerb.html', ' flowerlilyb.html', ' flowerlilya.html', ' flowercarnationb.html', ' flowercarnationa.html', ' flowerdaisya.html', ' flowerdaisyb.html', ' flowerorchida.html', ' flowerorchidb.html', ' flowertulipb.html', ' flowertulipa.html', ' flowerrosea.html', ' flowerroseb.html', ' flowerpoppya.html', ' flowerpoppyb.html')  then condition = 3;
else if task3 IN (' posmanipkennedyonassisb.html', ' posmanipkennedyonassisa.html', ' posmanipirwina.html', ' posmanipirwinb.html', ' posmanipdimaggioa.html', ' posmanipdimaggiob.html', ' posmanippitta.html', ' posmanippittb.html', ' posmanipcourica.html', ' posmanipcouricb.html', ' posmanipkbirda.html', ' posmanipbirdb.html', ' posmanipredforda.html', ' posmanipredfordb.html', ' posmanipgwashingtona.html', ' posmanipgwashingtonb.html', ' posmaniplennona.html', ' posmaniplennonb.html', ' posmaniparmstronga.html', ' posmaniparmstongb.html')  then condition = 2;
else if task3 IN (' negmanipmcveigha.html', ' negmanipmcveighb.html', ' negmanipdahmerb.html', ' negmanipdahmera.html', ' negmanipbundyb.html', ' negmanipbundya.html', ' negmanipgottia.html', ' negmanipgottib.html', ' negmanipyatesb.html', ' negmanipyatesa.html', ' negmanipatkinsa.html', ' negmanipatkinsb.html', ' negmanipkaczynskia.html', ' negmanipkaczynskib.html', ' negmanipskillinga.html', ' negmanipskillingb.html', ' negmanipmansonb.html', ' negmanipmansona.html', ' negmaniphitlerb.html', ' negmaniphitlera.html') then condition = 1;

if task4 IN (' floweririsb.html', ' floweririsa.html', ' flowerhibiscusb.html', ' flowerhibiscusa.html', ' flowersunflowera.html', ' flowersunflowerb.html', ' flowerlilyb.html', ' flowerlilya.html', ' flowercarnationb.html', ' flowercarnationa.html', ' flowerdaisya.html', ' flowerdaisyb.html', ' flowerorchida.html', ' flowerorchidb.html', ' flowertulipb.html', ' flowertulipa.html', ' flowerrosea.html', ' flowerroseb.html', ' flowerpoppya.html', ' flowerpoppyb.html')  then condition = 3;
else if task4 IN (' posmanipkennedyonassisb.html', ' posmanipkennedyonassisa.html', ' posmanipirwina.html', ' posmanipirwinb.html', ' posmanipdimaggioa.html', ' posmanipdimaggiob.html', ' posmanippitta.html', ' posmanippittb.html', ' posmanipcourica.html', ' posmanipcouricb.html', ' posmanipkbirda.html', ' posmanipbirdb.html', ' posmanipredforda.html', ' posmanipredfordb.html', ' posmanipgwashingtona.html', ' posmanipgwashingtonb.html', ' posmaniplennona.html', ' posmaniplennonb.html', ' posmaniparmstronga.html', ' posmaniparmstongb.html')  then condition = 2;
else if task4 IN (' negmanipmcveigha.html', ' negmanipmcveighb.html', ' negmanipdahmerb.html', ' negmanipdahmera.html', ' negmanipbundyb.html', ' negmanipbundya.html', ' negmanipgottia.html', ' negmanipgottib.html', ' negmanipyatesb.html', ' negmanipyatesa.html', ' negmanipatkinsa.html', ' negmanipatkinsb.html', ' negmanipkaczynskia.html', ' negmanipkaczynskib.html', ' negmanipskillinga.html', ' negmanipskillingb.html', ' negmanipmansonb.html', ' negmanipmansona.html', ' negmaniphitlerb.html', ' negmaniphitlera.html') then condition = 1;

if task5 IN (' floweririsb.html', ' floweririsa.html', ' flowerhibiscusb.html', ' flowerhibiscusa.html', ' flowersunflowera.html', ' flowersunflowerb.html', ' flowerlilyb.html', ' flowerlilya.html', ' flowercarnationb.html', ' flowercarnationa.html', ' flowerdaisya.html', ' flowerdaisyb.html', ' flowerorchida.html', ' flowerorchidb.html', ' flowertulipb.html', ' flowertulipa.html', ' flowerrosea.html', ' flowerroseb.html', ' flowerpoppya.html', ' flowerpoppyb.html')  then condition = 3;
else if task5 IN (' posmanipkennedyonassisb.html', ' posmanipkennedyonassisa.html', ' posmanipirwina.html', ' posmanipirwinb.html', ' posmanipdimaggioa.html', ' posmanipdimaggiob.html', ' posmanippitta.html', ' posmanippittb.html', ' posmanipcourica.html', ' posmanipcouricb.html', ' posmanipkbirda.html', ' posmanipbirdb.html', ' posmanipredforda.html', ' posmanipredfordb.html', ' posmanipgwashingtona.html', ' posmanipgwashingtonb.html', ' posmaniplennona.html', ' posmaniplennonb.html', ' posmaniparmstronga.html', ' posmaniparmstongb.html')  then condition = 2;
else if task5 IN (' negmanipmcveigha.html', ' negmanipmcveighb.html', ' negmanipdahmerb.html', ' negmanipdahmera.html', ' negmanipbundyb.html', ' negmanipbundya.html', ' negmanipgottia.html', ' negmanipgottib.html', ' negmanipyatesb.html', ' negmanipyatesa.html', ' negmanipatkinsa.html', ' negmanipatkinsb.html', ' negmanipkaczynskia.html', ' negmanipkaczynskib.html', ' negmanipskillinga.html', ' negmanipskillingb.html', ' negmanipmansonb.html', ' negmanipmansona.html', ' negmaniphitlerb.html', ' negmaniphitlera.html') then condition = 1;

if task6 IN (' floweririsb.html', ' floweririsa.html', ' flowerhibiscusb.html', ' flowerhibiscusa.html', ' flowersunflowera.html', ' flowersunflowerb.html', ' flowerlilyb.html', ' flowerlilya.html', ' flowercarnationb.html', ' flowercarnationa.html', ' flowerdaisya.html', ' flowerdaisyb.html', ' flowerorchida.html', ' flowerorchidb.html', ' flowertulipb.html', ' flowertulipa.html', ' flowerrosea.html', ' flowerroseb.html', ' flowerpoppya.html', ' flowerpoppyb.html')  then condition = 3;
else if task6 IN (' posmanipkennedyonassisb.html', ' posmanipkennedyonassisa.html', ' posmanipirwina.html', ' posmanipirwinb.html', ' posmanipdimaggioa.html', ' posmanipdimaggiob.html', ' posmanippitta.html', ' posmanippittb.html', ' posmanipcourica.html', ' posmanipcouricb.html', ' posmanipkbirda.html', ' posmanipbirdb.html', ' posmanipredforda.html', ' posmanipredfordb.html', ' posmanipgwashingtona.html', ' posmanipgwashingtonb.html', ' posmaniplennona.html', ' posmaniplennonb.html', ' posmaniparmstronga.html', ' posmaniparmstongb.html')  then condition = 2;
else if task6 IN (' negmanipmcveigha.html', ' negmanipmcveighb.html', ' negmanipdahmerb.html', ' negmanipdahmera.html', ' negmanipbundyb.html', ' negmanipbundya.html', ' negmanipgottia.html', ' negmanipgottib.html', ' negmanipyatesb.html', ' negmanipyatesa.html', ' negmanipatkinsa.html', ' negmanipatkinsb.html', ' negmanipkaczynskia.html', ' negmanipkaczynskib.html', ' negmanipskillinga.html', ' negmanipskillingb.html', ' negmanipmansonb.html', ' negmanipmansona.html', ' negmaniphitlerb.html', ' negmaniphitlera.html') then condition = 1;

if task7 IN (' floweririsb.html', ' floweririsa.html', ' flowerhibiscusb.html', ' flowerhibiscusa.html', ' flowersunflowera.html', ' flowersunflowerb.html', ' flowerlilyb.html', ' flowerlilya.html', ' flowercarnationb.html', ' flowercarnationa.html', ' flowerdaisya.html', ' flowerdaisyb.html', ' flowerorchida.html', ' flowerorchidb.html', ' flowertulipb.html', ' flowertulipa.html', ' flowerrosea.html', ' flowerroseb.html', ' flowerpoppya.html', ' flowerpoppyb.html')  then condition = 3;
else if task7 IN (' posmanipkennedyonassisb.html', ' posmanipkennedyonassisa.html', ' posmanipirwina.html', ' posmanipirwinb.html', ' posmanipdimaggioa.html', ' posmanipdimaggiob.html', ' posmanippitta.html', ' posmanippittb.html', ' posmanipcourica.html', ' posmanipcouricb.html', ' posmanipkbirda.html', ' posmanipbirdb.html', ' posmanipredforda.html', ' posmanipredfordb.html', ' posmanipgwashingtona.html', ' posmanipgwashingtonb.html', ' posmaniplennona.html', ' posmaniplennonb.html', ' posmaniparmstronga.html', ' posmaniparmstongb.html')  then condition = 2;
else if task7 IN (' negmanipmcveigha.html', ' negmanipmcveighb.html', ' negmanipdahmerb.html', ' negmanipdahmera.html', ' negmanipbundyb.html', ' negmanipbundya.html', ' negmanipgottia.html', ' negmanipgottib.html', ' negmanipyatesb.html', ' negmanipyatesa.html', ' negmanipatkinsa.html', ' negmanipatkinsb.html', ' negmanipkaczynskia.html', ' negmanipkaczynskib.html', ' negmanipskillinga.html', ' negmanipskillingb.html', ' negmanipmansonb.html', ' negmanipmansona.html', ' negmaniphitlerb.html', ' negmaniphitlera.html') then condition = 1;

if task8 IN (' floweririsb.html', ' floweririsa.html', ' flowerhibiscusb.html', ' flowerhibiscusa.html', ' flowersunflowera.html', ' flowersunflowerb.html', ' flowerlilyb.html', ' flowerlilya.html', ' flowercarnationb.html', ' flowercarnationa.html', ' flowerdaisya.html', ' flowerdaisyb.html', ' flowerorchida.html', ' flowerorchidb.html', ' flowertulipb.html', ' flowertulipa.html', ' flowerrosea.html', ' flowerroseb.html', ' flowerpoppya.html', ' flowerpoppyb.html')  then condition = 3;
else if task8 IN (' posmanipkennedyonassisb.html', ' posmanipkennedyonassisa.html', ' posmanipirwina.html', ' posmanipirwinb.html', ' posmanipdimaggioa.html', ' posmanipdimaggiob.html', ' posmanippitta.html', ' posmanippittb.html', ' posmanipcourica.html', ' posmanipcouricb.html', ' posmanipkbirda.html', ' posmanipbirdb.html', ' posmanipredforda.html', ' posmanipredfordb.html', ' posmanipgwashingtona.html', ' posmanipgwashingtonb.html', ' posmaniplennona.html', ' posmaniplennonb.html', ' posmaniparmstronga.html', ' posmaniparmstongb.html')  then condition = 2;
else if task8 IN (' negmanipmcveigha.html', ' negmanipmcveighb.html', ' negmanipdahmerb.html', ' negmanipdahmera.html', ' negmanipbundyb.html', ' negmanipbundya.html', ' negmanipgottia.html', ' negmanipgottib.html', ' negmanipyatesb.html', ' negmanipyatesa.html', ' negmanipatkinsa.html', ' negmanipatkinsb.html', ' negmanipkaczynskia.html', ' negmanipkaczynskib.html', ' negmanipskillinga.html', ' negmanipskillingb.html', ' negmanipmansonb.html', ' negmanipmansona.html', ' negmaniphitlerb.html', ' negmaniphitlera.html') then condition = 1;

if task9 IN (' floweririsb.html', ' floweririsa.html', ' flowerhibiscusb.html', ' flowerhibiscusa.html', ' flowersunflowera.html', ' flowersunflowerb.html', ' flowerlilyb.html', ' flowerlilya.html', ' flowercarnationb.html', ' flowercarnationa.html', ' flowerdaisya.html', ' flowerdaisyb.html', ' flowerorchida.html', ' flowerorchidb.html', ' flowertulipb.html', ' flowertulipa.html', ' flowerrosea.html', ' flowerroseb.html', ' flowerpoppya.html', ' flowerpoppyb.html')  then condition = 3;
else if task9 IN (' posmanipkennedyonassisb.html', ' posmanipkennedyonassisa.html', ' posmanipirwina.html', ' posmanipirwinb.html', ' posmanipdimaggioa.html', ' posmanipdimaggiob.html', ' posmanippitta.html', ' posmanippittb.html', ' posmanipcourica.html', ' posmanipcouricb.html', ' posmanipkbirda.html', ' posmanipbirdb.html', ' posmanipredforda.html', ' posmanipredfordb.html', ' posmanipgwashingtona.html', ' posmanipgwashingtonb.html', ' posmaniplennona.html', ' posmaniplennonb.html', ' posmaniparmstronga.html', ' posmaniparmstongb.html')  then condition = 2;
else if task9 IN (' negmanipmcveigha.html', ' negmanipmcveighb.html', ' negmanipdahmerb.html', ' negmanipdahmera.html', ' negmanipbundyb.html', ' negmanipbundya.html', ' negmanipgottia.html', ' negmanipgottib.html', ' negmanipyatesb.html', ' negmanipyatesa.html', ' negmanipatkinsa.html', ' negmanipatkinsb.html', ' negmanipkaczynskia.html', ' negmanipkaczynskib.html', ' negmanipskillinga.html', ' negmanipskillingb.html', ' negmanipmansonb.html', ' negmanipmansona.html', ' negmaniphitlerb.html', ' negmaniphitlera.html') then condition = 1;

if task10 IN (' floweririsb.html', ' floweririsa.html', ' flowerhibiscusb.html', ' flowerhibiscusa.html', ' flowersunflowera.html', ' flowersunflowerb.html', ' flowerlilyb.html', ' flowerlilya.html', ' flowercarnationb.html', ' flowercarnationa.html', ' flowerdaisya.html', ' flowerdaisyb.html', ' flowerorchida.html', ' flowerorchidb.html', ' flowertulipb.html', ' flowertulipa.html', ' flowerrosea.html', ' flowerroseb.html', ' flowerpoppya.html', ' flowerpoppyb.html')  then condition = 3;
else if task10 IN (' posmanipkennedyonassisb.html', ' posmanipkennedyonassisa.html', ' posmanipirwina.html', ' posmanipirwinb.html', ' posmanipdimaggioa.html', ' posmanipdimaggiob.html', ' posmanippitta.html', ' posmanippittb.html', ' posmanipcourica.html', ' posmanipcouricb.html', ' posmanipkbirda.html', ' posmanipbirdb.html', ' posmanipredforda.html', ' posmanipredfordb.html', ' posmanipgwashingtona.html', ' posmanipgwashingtonb.html', ' posmaniplennona.html', ' posmaniplennonb.html', ' posmaniparmstronga.html', ' posmaniparmstongb.html')  then condition = 2;
else if task10 IN (' negmanipmcveigha.html', ' negmanipmcveighb.html', ' negmanipdahmerb.html', ' negmanipdahmera.html', ' negmanipbundyb.html', ' negmanipbundya.html', ' negmanipgottia.html', ' negmanipgottib.html', ' negmanipyatesb.html', ' negmanipyatesa.html', ' negmanipatkinsa.html', ' negmanipatkinsb.html', ' negmanipkaczynskia.html', ' negmanipkaczynskib.html', ' negmanipskillinga.html', ' negmanipskillingb.html', ' negmanipmansonb.html', ' negmanipmansona.html', ' negmaniphitlerb.html', ' negmaniphitlera.html') then condition = 1;

if task11 IN (' floweririsb.html', ' floweririsa.html', ' flowerhibiscusb.html', ' flowerhibiscusa.html', ' flowersunflowera.html', ' flowersunflowerb.html', ' flowerlilyb.html', ' flowerlilya.html', ' flowercarnationb.html', ' flowercarnationa.html', ' flowerdaisya.html', ' flowerdaisyb.html', ' flowerorchida.html', ' flowerorchidb.html', ' flowertulipb.html', ' flowertulipa.html', ' flowerrosea.html', ' flowerroseb.html', ' flowerpoppya.html', ' flowerpoppyb.html')  then condition = 3;
else if task11 IN (' posmanipkennedyonassisb.html', ' posmanipkennedyonassisa.html', ' posmanipirwina.html', ' posmanipirwinb.html', ' posmanipdimaggioa.html', ' posmanipdimaggiob.html', ' posmanippitta.html', ' posmanippittb.html', ' posmanipcourica.html', ' posmanipcouricb.html', ' posmanipkbirda.html', ' posmanipbirdb.html', ' posmanipredforda.html', ' posmanipredfordb.html', ' posmanipgwashingtona.html', ' posmanipgwashingtonb.html', ' posmaniplennona.html', ' posmaniplennonb.html', ' posmaniparmstronga.html', ' posmaniparmstongb.html')  then condition = 2;
else if task11 IN (' negmanipmcveigha.html', ' negmanipmcveighb.html', ' negmanipdahmerb.html', ' negmanipdahmera.html', ' negmanipbundyb.html', ' negmanipbundya.html', ' negmanipgottia.html', ' negmanipgottib.html', ' negmanipyatesb.html', ' negmanipyatesa.html', ' negmanipatkinsa.html', ' negmanipatkinsb.html', ' negmanipkaczynskia.html', ' negmanipkaczynskib.html', ' negmanipskillinga.html', ' negmanipskillingb.html', ' negmanipmansonb.html', ' negmanipmansona.html', ' negmaniphitlerb.html', ' negmaniphitlera.html') then condition = 1;

if task12 IN (' floweririsb.html', ' floweririsa.html', ' flowerhibiscusb.html', ' flowerhibiscusa.html', ' flowersunflowera.html', ' flowersunflowerb.html', ' flowerlilyb.html', ' flowerlilya.html', ' flowercarnationb.html', ' flowercarnationa.html', ' flowerdaisya.html', ' flowerdaisyb.html', ' flowerorchida.html', ' flowerorchidb.html', ' flowertulipb.html', ' flowertulipa.html', ' flowerrosea.html', ' flowerroseb.html', ' flowerpoppya.html', ' flowerpoppyb.html')  then condition = 3;
else if task12 IN (' posmanipkennedyonassisb.html', ' posmanipkennedyonassisa.html', ' posmanipirwina.html', ' posmanipirwinb.html', ' posmanipdimaggioa.html', ' posmanipdimaggiob.html', ' posmanippitta.html', ' posmanippittb.html', ' posmanipcourica.html', ' posmanipcouricb.html', ' posmanipkbirda.html', ' posmanipbirdb.html', ' posmanipredforda.html', ' posmanipredfordb.html', ' posmanipgwashingtona.html', ' posmanipgwashingtonb.html', ' posmaniplennona.html', ' posmaniplennonb.html', ' posmaniparmstronga.html', ' posmaniparmstongb.html')  then condition = 2;
else if task12 IN (' negmanipmcveigha.html', ' negmanipmcveighb.html', ' negmanipdahmerb.html', ' negmanipdahmera.html', ' negmanipbundyb.html', ' negmanipbundya.html', ' negmanipgottia.html', ' negmanipgottib.html', ' negmanipyatesb.html', ' negmanipyatesa.html', ' negmanipatkinsa.html', ' negmanipatkinsb.html', ' negmanipkaczynskia.html', ' negmanipkaczynskib.html', ' negmanipskillinga.html', ' negmanipskillingb.html', ' negmanipmansonb.html', ' negmanipmansona.html', ' negmaniphitlerb.html', ' negmaniphitlera.html') then condition = 1;

if task13 IN (' floweririsb.html', ' floweririsa.html', ' flowerhibiscusb.html', ' flowerhibiscusa.html', ' flowersunflowera.html', ' flowersunflowerb.html', ' flowerlilyb.html', ' flowerlilya.html', ' flowercarnationb.html', ' flowercarnationa.html', ' flowerdaisya.html', ' flowerdaisyb.html', ' flowerorchida.html', ' flowerorchidb.html', ' flowertulipb.html', ' flowertulipa.html', ' flowerrosea.html', ' flowerroseb.html', ' flowerpoppya.html', ' flowerpoppyb.html')  then condition = 3;
else if task13 IN (' posmanipkennedyonassisb.html', ' posmanipkennedyonassisa.html', ' posmanipirwina.html', ' posmanipirwinb.html', ' posmanipdimaggioa.html', ' posmanipdimaggiob.html', ' posmanippitta.html', ' posmanippittb.html', ' posmanipcourica.html', ' posmanipcouricb.html', ' posmanipkbirda.html', ' posmanipbirdb.html', ' posmanipredforda.html', ' posmanipredfordb.html', ' posmanipgwashingtona.html', ' posmanipgwashingtonb.html', ' posmaniplennona.html', ' posmaniplennonb.html', ' posmaniparmstronga.html', ' posmaniparmstongb.html')  then condition = 2;
else if task13 IN (' negmanipmcveigha.html', ' negmanipmcveighb.html', ' negmanipdahmerb.html', ' negmanipdahmera.html', ' negmanipbundyb.html', ' negmanipbundya.html', ' negmanipgottia.html', ' negmanipgottib.html', ' negmanipyatesb.html', ' negmanipyatesa.html', ' negmanipatkinsa.html', ' negmanipatkinsb.html', ' negmanipkaczynskia.html', ' negmanipkaczynskib.html', ' negmanipskillinga.html', ' negmanipskillingb.html', ' negmanipmansonb.html', ' negmanipmansona.html', ' negmaniphitlerb.html', ' negmaniphitlera.html') then condition = 1;

if task14 IN (' floweririsb.html', ' floweririsa.html', ' flowerhibiscusb.html', ' flowerhibiscusa.html', ' flowersunflowera.html', ' flowersunflowerb.html', ' flowerlilyb.html', ' flowerlilya.html', ' flowercarnationb.html', ' flowercarnationa.html', ' flowerdaisya.html', ' flowerdaisyb.html', ' flowerorchida.html', ' flowerorchidb.html', ' flowertulipb.html', ' flowertulipa.html', ' flowerrosea.html', ' flowerroseb.html', ' flowerpoppya.html', ' flowerpoppyb.html')  then condition = 3;
else if task14 IN (' posmanipkennedyonassisb.html', ' posmanipkennedyonassisa.html', ' posmanipirwina.html', ' posmanipirwinb.html', ' posmanipdimaggioa.html', ' posmanipdimaggiob.html', ' posmanippitta.html', ' posmanippittb.html', ' posmanipcourica.html', ' posmanipcouricb.html', ' posmanipkbirda.html', ' posmanipbirdb.html', ' posmanipredforda.html', ' posmanipredfordb.html', ' posmanipgwashingtona.html', ' posmanipgwashingtonb.html', ' posmaniplennona.html', ' posmaniplennonb.html', ' posmaniparmstronga.html', ' posmaniparmstongb.html')  then condition = 2;
else if task14 IN (' negmanipmcveigha.html', ' negmanipmcveighb.html', ' negmanipdahmerb.html', ' negmanipdahmera.html', ' negmanipbundyb.html', ' negmanipbundya.html', ' negmanipgottia.html', ' negmanipgottib.html', ' negmanipyatesb.html', ' negmanipyatesa.html', ' negmanipatkinsa.html', ' negmanipatkinsb.html', ' negmanipkaczynskia.html', ' negmanipkaczynskib.html', ' negmanipskillinga.html', ' negmanipskillingb.html', ' negmanipmansonb.html', ' negmanipmansona.html', ' negmaniphitlerb.html', ' negmaniphitlera.html') then condition = 1;

if task15 IN (' floweririsb.html', ' floweririsa.html', ' flowerhibiscusb.html', ' flowerhibiscusa.html', ' flowersunflowera.html', ' flowersunflowerb.html', ' flowerlilyb.html', ' flowerlilya.html', ' flowercarnationb.html', ' flowercarnationa.html', ' flowerdaisya.html', ' flowerdaisyb.html', ' flowerorchida.html', ' flowerorchidb.html', ' flowertulipb.html', ' flowertulipa.html', ' flowerrosea.html', ' flowerroseb.html', ' flowerpoppya.html', ' flowerpoppyb.html')  then condition = 3;
else if task15 IN (' posmanipkennedyonassisb.html', ' posmanipkennedyonassisa.html', ' posmanipirwina.html', ' posmanipirwinb.html', ' posmanipdimaggioa.html', ' posmanipdimaggiob.html', ' posmanippitta.html', ' posmanippittb.html', ' posmanipcourica.html', ' posmanipcouricb.html', ' posmanipkbirda.html', ' posmanipbirdb.html', ' posmanipredforda.html', ' posmanipredfordb.html', ' posmanipgwashingtona.html', ' posmanipgwashingtonb.html', ' posmaniplennona.html', ' posmaniplennonb.html', ' posmaniparmstronga.html', ' posmaniparmstongb.html')  then condition = 2;
else if task15 IN (' negmanipmcveigha.html', ' negmanipmcveighb.html', ' negmanipdahmerb.html', ' negmanipdahmera.html', ' negmanipbundyb.html', ' negmanipbundya.html', ' negmanipgottia.html', ' negmanipgottib.html', ' negmanipyatesb.html', ' negmanipyatesa.html', ' negmanipatkinsa.html', ' negmanipatkinsb.html', ' negmanipkaczynskia.html', ' negmanipkaczynskib.html', ' negmanipskillinga.html', ' negmanipskillingb.html', ' negmanipmansonb.html', ' negmanipmansona.html', ' negmaniphitlerb.html', ' negmaniphitlera.html') then condition = 1;

if task15 IN (' floweririsb.html', ' floweririsa.html', ' flowerhibiscusb.html', ' flowerhibiscusa.html', ' flowersunflowera.html', ' flowersunflowerb.html', ' flowerlilyb.html', ' flowerlilya.html', ' flowercarnationb.html', ' flowercarnationa.html', ' flowerdaisya.html', ' flowerdaisyb.html', ' flowerorchida.html', ' flowerorchidb.html', ' flowertulipb.html', ' flowertulipa.html', ' flowerrosea.html', ' flowerroseb.html', ' flowerpoppya.html', ' flowerpoppyb.html')  then condition = 3;
else if task15 IN (' posmanipkennedyonassisb.html', ' posmanipkennedyonassisa.html', ' posmanipirwina.html', ' posmanipirwinb.html', ' posmanipdimaggioa.html', ' posmanipdimaggiob.html', ' posmanippitta.html', ' posmanippittb.html', ' posmanipcourica.html', ' posmanipcouricb.html', ' posmanipkbirda.html', ' posmanipbirdb.html', ' posmanipredforda.html', ' posmanipredfordb.html', ' posmanipgwashingtona.html', ' posmanipgwashingtonb.html', ' posmaniplennona.html', ' posmaniplennonb.html', ' posmaniparmstronga.html', ' posmaniparmstongb.html')  then condition = 2;
else if task15 IN (' negmanipmcveigha.html', ' negmanipmcveighb.html', ' negmanipdahmerb.html', ' negmanipdahmera.html', ' negmanipbundyb.html', ' negmanipbundya.html', ' negmanipgottia.html', ' negmanipgottib.html', ' negmanipyatesb.html', ' negmanipyatesa.html', ' negmanipatkinsa.html', ' negmanipatkinsb.html', ' negmanipkaczynskia.html', ' negmanipkaczynskib.html', ' negmanipskillinga.html', ' negmanipskillingb.html', ' negmanipmansonb.html', ' negmanipmansona.html', ' negmaniphitlerb.html', ' negmaniphitlera.html') then condition = 1;

if task16 IN (' floweririsb.html', ' floweririsa.html', ' flowerhibiscusb.html', ' flowerhibiscusa.html', ' flowersunflowera.html', ' flowersunflowerb.html', ' flowerlilyb.html', ' flowerlilya.html', ' flowercarnationb.html', ' flowercarnationa.html', ' flowerdaisya.html', ' flowerdaisyb.html', ' flowerorchida.html', ' flowerorchidb.html', ' flowertulipb.html', ' flowertulipa.html', ' flowerrosea.html', ' flowerroseb.html', ' flowerpoppya.html', ' flowerpoppyb.html')  then condition = 3;
else if task16 IN (' posmanipkennedyonassisb.html', ' posmanipkennedyonassisa.html', ' posmanipirwina.html', ' posmanipirwinb.html', ' posmanipdimaggioa.html', ' posmanipdimaggiob.html', ' posmanippitta.html', ' posmanippittb.html', ' posmanipcourica.html', ' posmanipcouricb.html', ' posmanipkbirda.html', ' posmanipbirdb.html', ' posmanipredforda.html', ' posmanipredfordb.html', ' posmanipgwashingtona.html', ' posmanipgwashingtonb.html', ' posmaniplennona.html', ' posmaniplennonb.html', ' posmaniparmstronga.html', ' posmaniparmstongb.html')  then condition = 2;
else if task16 IN (' negmanipmcveigha.html', ' negmanipmcveighb.html', ' negmanipdahmerb.html', ' negmanipdahmera.html', ' negmanipbundyb.html', ' negmanipbundya.html', ' negmanipgottia.html', ' negmanipgottib.html', ' negmanipyatesb.html', ' negmanipyatesa.html', ' negmanipatkinsa.html', ' negmanipatkinsb.html', ' negmanipkaczynskia.html', ' negmanipkaczynskib.html', ' negmanipskillinga.html', ' negmanipskillingb.html', ' negmanipmansonb.html', ' negmanipmansona.html', ' negmaniphitlerb.html', ' negmaniphitlera.html') then condition = 1;

if task17 IN (' floweririsb.html', ' floweririsa.html', ' flowerhibiscusb.html', ' flowerhibiscusa.html', ' flowersunflowera.html', ' flowersunflowerb.html', ' flowerlilyb.html', ' flowerlilya.html', ' flowercarnationb.html', ' flowercarnationa.html', ' flowerdaisya.html', ' flowerdaisyb.html', ' flowerorchida.html', ' flowerorchidb.html', ' flowertulipb.html', ' flowertulipa.html', ' flowerrosea.html', ' flowerroseb.html', ' flowerpoppya.html', ' flowerpoppyb.html')  then condition = 3;
else if task17 IN (' posmanipkennedyonassisb.html', ' posmanipkennedyonassisa.html', ' posmanipirwina.html', ' posmanipirwinb.html', ' posmanipdimaggioa.html', ' posmanipdimaggiob.html', ' posmanippitta.html', ' posmanippittb.html', ' posmanipcourica.html', ' posmanipcouricb.html', ' posmanipkbirda.html', ' posmanipbirdb.html', ' posmanipredforda.html', ' posmanipredfordb.html', ' posmanipgwashingtona.html', ' posmanipgwashingtonb.html', ' posmaniplennona.html', ' posmaniplennonb.html', ' posmaniparmstronga.html', ' posmaniparmstongb.html')  then condition = 2;
else if task17 IN (' negmanipmcveigha.html', ' negmanipmcveighb.html', ' negmanipdahmerb.html', ' negmanipdahmera.html', ' negmanipbundyb.html', ' negmanipbundya.html', ' negmanipgottia.html', ' negmanipgottib.html', ' negmanipyatesb.html', ' negmanipyatesa.html', ' negmanipatkinsa.html', ' negmanipatkinsb.html', ' negmanipkaczynskia.html', ' negmanipkaczynskib.html', ' negmanipskillinga.html', ' negmanipskillingb.html', ' negmanipmansonb.html', ' negmanipmansona.html', ' negmaniphitlerb.html', ' negmaniphitlera.html') then condition = 1;

if task18 IN (' floweririsb.html', ' floweririsa.html', ' flowerhibiscusb.html', ' flowerhibiscusa.html', ' flowersunflowera.html', ' flowersunflowerb.html', ' flowerlilyb.html', ' flowerlilya.html', ' flowercarnationb.html', ' flowercarnationa.html', ' flowerdaisya.html', ' flowerdaisyb.html', ' flowerorchida.html', ' flowerorchidb.html', ' flowertulipb.html', ' flowertulipa.html', ' flowerrosea.html', ' flowerroseb.html', ' flowerpoppya.html', ' flowerpoppyb.html')  then condition = 3;
else if task18 IN (' posmanipkennedyonassisb.html', ' posmanipkennedyonassisa.html', ' posmanipirwina.html', ' posmanipirwinb.html', ' posmanipdimaggioa.html', ' posmanipdimaggiob.html', ' posmanippitta.html', ' posmanippittb.html', ' posmanipcourica.html', ' posmanipcouricb.html', ' posmanipkbirda.html', ' posmanipbirdb.html', ' posmanipredforda.html', ' posmanipredfordb.html', ' posmanipgwashingtona.html', ' posmanipgwashingtonb.html', ' posmaniplennona.html', ' posmaniplennonb.html', ' posmaniparmstronga.html', ' posmaniparmstongb.html')  then condition = 2;
else if task18 IN (' negmanipmcveigha.html', ' negmanipmcveighb.html', ' negmanipdahmerb.html', ' negmanipdahmera.html', ' negmanipbundyb.html', ' negmanipbundya.html', ' negmanipgottia.html', ' negmanipgottib.html', ' negmanipyatesb.html', ' negmanipyatesa.html', ' negmanipatkinsa.html', ' negmanipatkinsb.html', ' negmanipkaczynskia.html', ' negmanipkaczynskib.html', ' negmanipskillinga.html', ' negmanipskillingb.html', ' negmanipmansonb.html', ' negmanipmansona.html', ' negmaniphitlerb.html', ' negmaniphitlera.html') then condition = 1;

if task19 IN (' floweririsb.html', ' floweririsa.html', ' flowerhibiscusb.html', ' flowerhibiscusa.html', ' flowersunflowera.html', ' flowersunflowerb.html', ' flowerlilyb.html', ' flowerlilya.html', ' flowercarnationb.html', ' flowercarnationa.html', ' flowerdaisya.html', ' flowerdaisyb.html', ' flowerorchida.html', ' flowerorchidb.html', ' flowertulipb.html', ' flowertulipa.html', ' flowerrosea.html', ' flowerroseb.html', ' flowerpoppya.html', ' flowerpoppyb.html')  then condition = 3;
else if task19 IN (' posmanipkennedyonassisb.html', ' posmanipkennedyonassisa.html', ' posmanipirwina.html', ' posmanipirwinb.html', ' posmanipdimaggioa.html', ' posmanipdimaggiob.html', ' posmanippitta.html', ' posmanippittb.html', ' posmanipcourica.html', ' posmanipcouricb.html', ' posmanipkbirda.html', ' posmanipbirdb.html', ' posmanipredforda.html', ' posmanipredfordb.html', ' posmanipgwashingtona.html', ' posmanipgwashingtonb.html', ' posmaniplennona.html', ' posmaniplennonb.html', ' posmaniparmstronga.html', ' posmaniparmstongb.html')  then condition = 2;
else if task19 IN (' negmanipmcveigha.html', ' negmanipmcveighb.html', ' negmanipdahmerb.html', ' negmanipdahmera.html', ' negmanipbundyb.html', ' negmanipbundya.html', ' negmanipgottia.html', ' negmanipgottib.html', ' negmanipyatesb.html', ' negmanipyatesa.html', ' negmanipatkinsa.html', ' negmanipatkinsb.html', ' negmanipkaczynskia.html', ' negmanipkaczynskib.html', ' negmanipskillinga.html', ' negmanipskillingb.html', ' negmanipmansonb.html', ' negmanipmansona.html', ' negmaniphitlerb.html', ' negmaniphitlera.html') then condition = 1;

if task20 IN (' floweririsb.html', ' floweririsa.html', ' flowerhibiscusb.html', ' flowerhibiscusa.html', ' flowersunflowera.html', ' flowersunflowerb.html', ' flowerlilyb.html', ' flowerlilya.html', ' flowercarnationb.html', ' flowercarnationa.html', ' flowerdaisya.html', ' flowerdaisyb.html', ' flowerorchida.html', ' flowerorchidb.html', ' flowertulipb.html', ' flowertulipa.html', ' flowerrosea.html', ' flowerroseb.html', ' flowerpoppya.html', ' flowerpoppyb.html')  then condition = 3;
else if task20 IN (' posmanipkennedyonassisb.html', ' posmanipkennedyonassisa.html', ' posmanipirwina.html', ' posmanipirwinb.html', ' posmanipdimaggioa.html', ' posmanipdimaggiob.html', ' posmanippitta.html', ' posmanippittb.html', ' posmanipcourica.html', ' posmanipcouricb.html', ' posmanipkbirda.html', ' posmanipbirdb.html', ' posmanipredforda.html', ' posmanipredfordb.html', ' posmanipgwashingtona.html', ' posmanipgwashingtonb.html', ' posmaniplennona.html', ' posmaniplennonb.html', ' posmaniparmstronga.html', ' posmaniparmstongb.html')  then condition = 2;
else if task20 IN (' negmanipmcveigha.html', ' negmanipmcveighb.html', ' negmanipdahmerb.html', ' negmanipdahmera.html', ' negmanipbundyb.html', ' negmanipbundya.html', ' negmanipgottia.html', ' negmanipgottib.html', ' negmanipyatesb.html', ' negmanipyatesa.html', ' negmanipatkinsa.html', ' negmanipatkinsb.html', ' negmanipkaczynskia.html', ' negmanipkaczynskib.html', ' negmanipskillinga.html', ' negmanipskillingb.html', ' negmanipmansonb.html', ' negmanipmansona.html', ' negmaniphitlerb.html', ' negmaniphitlera.html') then condition = 1;

if task21 IN (' floweririsb.html', ' floweririsa.html', ' flowerhibiscusb.html', ' flowerhibiscusa.html', ' flowersunflowera.html', ' flowersunflowerb.html', ' flowerlilyb.html', ' flowerlilya.html', ' flowercarnationb.html', ' flowercarnationa.html', ' flowerdaisya.html', ' flowerdaisyb.html', ' flowerorchida.html', ' flowerorchidb.html', ' flowertulipb.html', ' flowertulipa.html', ' flowerrosea.html', ' flowerroseb.html', ' flowerpoppya.html', ' flowerpoppyb.html')  then condition = 3;
else if task21 IN (' posmanipkennedyonassisb.html', ' posmanipkennedyonassisa.html', ' posmanipirwina.html', ' posmanipirwinb.html', ' posmanipdimaggioa.html', ' posmanipdimaggiob.html', ' posmanippitta.html', ' posmanippittb.html', ' posmanipcourica.html', ' posmanipcouricb.html', ' posmanipkbirda.html', ' posmanipbirdb.html', ' posmanipredforda.html', ' posmanipredfordb.html', ' posmanipgwashingtona.html', ' posmanipgwashingtonb.html', ' posmaniplennona.html', ' posmaniplennonb.html', ' posmaniparmstronga.html', ' posmaniparmstongb.html')  then condition = 2;
else if task21 IN (' negmanipmcveigha.html', ' negmanipmcveighb.html', ' negmanipdahmerb.html', ' negmanipdahmera.html', ' negmanipbundyb.html', ' negmanipbundya.html', ' negmanipgottia.html', ' negmanipgottib.html', ' negmanipyatesb.html', ' negmanipyatesa.html', ' negmanipatkinsa.html', ' negmanipatkinsb.html', ' negmanipkaczynskia.html', ' negmanipkaczynskib.html', ' negmanipskillinga.html', ' negmanipskillingb.html', ' negmanipmansonb.html', ' negmanipmansona.html', ' negmaniphitlerb.html', ' negmaniphitlera.html') then condition = 1;
run;


proc freq data = web_out.sessioninfo; tables condition; run;


/*Condition 1 = Negative White/Positive Black manipulation = 503;
/*Condition 2 = Positive White/Positive Black manipulation = 431;
/*Condition 3 = Control manipulation = 448;




/************************************************/
/*                                              */
/*                EXPLICIT DATA                 */
/*                                              */
/************************************************/
data web_out.new_explicit; set web_in.explicit;
	if question_name = "text" OR question_name = "d" then delete; 
	if question_name = "IMPTASKTO" then delete; 
	if session_id = "913541" or session_id = "915595" or session_id = "915595" or session_id = "916913" then delete; 
run;
proc sort; 
by session_id; 
run;
proc transpose data= web_out.new_explicit out=web_out.clean_explicit_all; 
by session_id;
id question_name; 
var question_response; 
run;

/********************************************************/
/*            RECODING DATA INTO NUMERIC DATA           */
/********************************************************/

data web_out.clean_explicit_all; set web_out.clean_explicit_all;
Tblack1 = Tblack * 1;
Twhite1 = Twhite * 1;
attrace1 = attrace * 1;

posmanipking1 = posmanipkinga * 1;
posmanipking2 = posmanipkingb * 1;
posmanipwoods1 = posmanipwoodsa * 1;
posmanipwoods2 = posmanipwoodsb * 1;
posmanipowens1 = posmanipowensa * 1;
posmanipowens2 = posmanipowensb * 1;
posmanipmandela1 = posmanipmandelaa * 1;
posmanipmandela2 = posmanipmandelab * 1;
posmanipmorrison1 = posmanipmorrisona * 1;
posmanipmorrison2 = posmanipmorrisonb * 1;
posmanipwinfrey1 = posmanipwinfreya * 1;
posmanipwinfrey2 = posmanipwinfreyb * 1;
posmanipwashington1 = posmanipwashingtona * 1;
posmanipwashington2 = posmanipwashingtonb * 1;
posmanipcosby1 = posmanipcosbya * 1;
posmanipcosby2 = posmanipcosbyb * 1;
posmanipali1 = posmanipalia * 1;
posmanipali2 = posmanipalib * 1;
posmanipjordan1 = posmanipjordana * 1;
posmanipjordan2 = posmanipjordanb * 1;

choiceking1 = choicekinga * 1;
choiceking2 = choicekingb * 1;
choicewoods1 = choicewoodsa * 1;
choicewoods2 = choicewoodsb * 1;
choiceowens1 = choiceowensa * 1;
choiceowens2 = choiceowensb * 1;
choicemandela1 = choicemandelaa * 1;
choicemandela2 = choicemandelab * 1;
choicemorrison1 = choicemorrisona * 1;
choicemorrison2 = choicemorrisonb * 1;
choicewinfrey1 = choicewinfreya * 1;
choicewinfrey2 = choicewinfreyb * 1;
choicewashington1 = choicewashingtona * 1;
choicewashington2 = choicewashingtonb * 1;
choicecosby1 = choicecosbya * 1;
choicecosby2 = choicecosbyb * 1;
choiceali1 = choicealia * 1;
choiceali2 = choicealib * 1;
choicejordan1 = choicejordana * 1;
choicejordan2 = choicejordanb * 1;

posmanipirwin1 = posmanipirwina * 1;
posmanipirwin2 = posmanipirwinb * 1;
posmanipbird1 = posmanipbirda * 1;
posmanipbird2 = posmanipbirdb * 1;
posmanipkennedyonassis1 = posmanipkennedyonass * 1;
posmanipredford1 = posmanipredforda * 1;
posmanipredford2 = posmanipredfordb * 1;
posmanippitt1 = posmanippitta * 1;
posmanippitt2 = posmanippittb * 1;
posmanipgwashington1 = posmanipgwashingtona * 1;
posmanipgwashington2 = posmanipgwashingtonb * 1;
posmanipcouric1 = posmanipcourica * 1;
posmanipcouric2 = posmanipcouricb * 1;
posmaniplennon1 = posmaniplennona * 1;
posmaniplennon2 = posmaniplennonb * 1;
posmanipdimaggio1 = posmanipdimaggioa * 1;
posmanipdimaggio2 = posmanipdimaggiob * 1;
posmaniparmstrong1 = posmaniparmstronga * 1;
posmaniparmstrong2 = posmaniparmstrongb * 1;

choiceirwin1 = choiceirwina * 1;
choiceirwin2 = choiceirwinb * 1;
choicebird1 = choicebirda * 1;
choicebird2 = choicebirdb * 1;
choicebird3 = ageeinsteinb *1;
choicekennedyonassis1 = choicekennedyonassis * 1;
choiceredford1 = choiceredforda * 1;
choiceredford2 = choiceredfordb * 1;
choicepitt1 = choicepitta * 1;
choicepitt2 = choicepittb * 1;
choicegwashington1 = choicegwashingtona * 1;
choicegwashington2 = choicegwashingtonb * 1;
choicecouric1 = choicecourica * 1;
choicecouric2 = choicecouricb * 1;
choicelennon1 = choicelennona * 1;
choicelennon2 = choicelennonb * 1;
choicedimaggio1 = choicedimaggioa * 1;
choicedimaggio2 = choicedimaggiob * 1;
choicearmstrong1 = choicearmstronga * 1;
choicearmstrong2 = choicearmstrongb * 1;

negmanipgotti1 = negmanipgottia * 1;
negmanipgotti2 = negmanipgottib * 1;
negmanipdahmer1 = negmanipdahmera * 1;
negmanipdahmer2 = negmanipdahmerb * 1;
negmanipmanson1 = negmanipmansona * 1;
negmanipmanson2 = negmanipmansonb * 1;
negmanipmcveigh1 = negmanipmcveigha * 1;
negmanipmcveigh2 = negmanipmcveighb * 1;
negmanipskilling1 = negmanipskillinga * 1;
negmanipskilling2 = negmanipskillingb * 1;
negmanipatkins1 = negmanipatkinsa * 1;
negmanipatkins2 = negmanipatkinsb * 1;
negmanipyates1 = negmanipyatesa * 1;
negmanipyates2 = negmanipyatesb * 1;
negmanipkaczynski1 = negmanipkaczynskia * 1;
negmanipkaczynski2 = negmanipkaczynskib * 1;
negmanipbundy1 = negmanipbundya * 1;
negmanipbundy2 = negmanipbundyb * 1;
negmaniphitler1 = negmaniphitlera * 1;
negmaniphitler2 = negmaniphitlerb * 1;

choicegotti1 = choicegottia * 1;
choicegotti2 = choicegottib * 1;
choicedahmer1 = choicedahmera * 1;
choicedahmer2 = choicedahmerb * 1;
choicemanson1 = choicemansona * 1;
choicemanson2 = choicemansonb * 1;
choicemcveigh1 = choicemcveigha * 1;
choicemcveigh2 = choicemcveighb * 1;
choiceskilling1 = choiceskillinga * 1;
choiceskilling2 = choiceskillingb * 1;
choiceatkins1 = choiceatkinsa * 1;
choiceatkins2 = choiceatkinsb * 1;
choiceyates1 = choiceyatesa * 1;
choiceyates2 = choiceyatesb * 1;
choicekaczynski1 = choicekaczynskia * 1;
choicekaczynski2 = choicekaczynskib * 1;
choicebundy1 = choicebundya * 1;
choicebundy2 = choicebundyb * 1;
choicehitler1 = choicehitlera * 1;
choicehitler2 = choicehitlerb * 1;
choicehitler3 = choicehiltera * 1;
choicehitler4 = choicehilterb * 1;

flowerhibiscus1 = flowerhibiscusa * 1;
flowerhibiscus2 = flowerhibiscusb * 1;
flowerdaisy1 = flowerdaisya * 1;
flowerdaisy2 = flowerdaisyb * 1;
flowerlily1 = flowerlilya * 1;
flowerlily2 = flowerlilyb * 1;
flowerrose1 = flowerosea * 1;
flowerrose2 = flowerroseb * 1;
flowersunflower1 = flowersunflowera * 1;
flowersunflower2 = flowersunflowerb * 1;
flowerorchid1 = flowerorchida * 1;
flowerorchid2 = flowerorchidb * 1;
flowertulip1 = flowertulipa * 1;
flowertulip2 = flowertulipb * 1;
flowercarnation1 = flowercarnationa * 1;
flowercarnation2 = flowercarnationb * 1;
floweriris1 = floweririsa * 1;
floweriris2 = floweririsb * 1;
flowerpoppy1 = flowerpoppya * 1;
flowerpoppy2 = flowerpoppyb * 1;

choicehibiscus1 = choicehibiscusa * 1;
choicehibiscus2 = choicehibiscusb * 1;
choicedaisy1 = choicedaisya * 1;
choicedaisy2 = choicedaisyb * 1;
choicelily1 = choicelilya * 1;
choicelily2 = choicelilyb * 1;
choicerose1 = choicerosea * 1;
choicerose2 = choiceroseb * 1;
choicesunflower1 = choicesunflowera * 1;
choicesunflower2 = choicesunflowerb * 1;
choiceorchid1 = choiceorchida * 1;
choiceorchid2 = choiceorchidb * 1;
choicetulip1 = choicetulipa * 1;
choicetulip2 = choicetulipb * 1;
choicecarnation1 = choicecarnationa * 1;
choicecarnation2 = choicecarnationb * 1;
choiceiris1 = choiceirisa * 1;
choiceiris2 = choiceirisb * 1;
choicepoppy1 = choicepoppya * 1;
choicepoppy2 = choicepoppyb * 1;

insectant1 = insectanta * 1;
insectant2 = insectantb * 1;
insectprayingmantis1 = insectprayingmantisa * 1;
insectprayingmantis2 = insectprayingmantisb * 1;
insectbee1 = insectbeea * 1;
insectbee2 = insectbeeb * 1;
insectbutterfly1 = insectbutterflya * 1;
insectbutterfly2 = insectbutterflyb * 1;
insectbeetle1 = insectbeetlea * 1;
insectbeetle2 = insectbeetleb * 1;
insectcockroach1 = insectcockroacha * 1;
insectcockroach2 = insectcockroachb * 1;
insectcentipede1 = insectcentipedea * 1;
insectcentipede2 = insectcentipedeb * 1;
insectgrasshopper1 = insectgrasshoppera * 1;
insectgrasshopper2 = insectgrasshopperb * 1;
insectmosquito1 = insectmosquitoa * 1;
insectmosquito2 = insectmosquitob * 1;
insectdragonfly1 = insectdragonflya * 1;
insectdragonfly2 = insectdragonflyb * 1;

choiceant1 = choiceanta * 1;
choiceant2 = choiceantb * 1;
choiceprayingmantis1 = choiceprayingmantisa * 1;
choiceprayingmantis2 = choiceprayingmantisb * 1;
choicebee1 = choicebeea * 1;
choicebee2 = choicebeeb * 1;
choicebutterfly1 = choicebutterflya * 1;
choicebutterfly2 = choicebutteflyb * 1;
choicebeetle1 = choicebeetlea * 1;
choicebeetle2 = choicebeetleb * 1;
choicecockroach1 = choicecockroacha * 1;
choicecockroach2 = choicecockroachb * 1;
choicecentipede1 = choicecentipedea * 1;
choicecentipede2 = choicecentipedeb * 1;
choicegrasshopper1 = choicegrasshoppera * 1;
choicegrasshopper2 = choicegrasshopperb * 1;
choicemosquito1 = choicemosquitoa * 1;
choicemosquito2 = choicemosquitob * 1;
choicedragonfly1 = choicedragonflya * 1;
choicedragonfly2 = choicedragonflyb * 1;

manip_correct = 0;
if posmaniplennon1 = 1 then manip_correct = manip_correct + 1;
if posmaniplennon2 = 1 then manip_correct = manip_correct + 1;
if posmanipirwin1= 1 then manip_correct = manip_correct + 1;
if posmanipirwin2 = 1 then manip_correct = manip_correct + 1;
if posmanipbird1 = 1 then manip_correct = manip_correct + 1;
if posmanipbird2= 1 then manip_correct = manip_correct + 1;
if posmanipkennedyonassis1 = 1 then manip_correct = manip_correct + 1;
if posmanipredford1= 1 then manip_correct = manip_correct + 1;
if posmanipredford2= 1 then manip_correct = manip_correct + 1;
if posmanippitt1 = 1 then manip_correct = manip_correct + 1;
if posmanippitt2 = 1 then manip_correct = manip_correct + 1;
if posmanipgwashington1 = 1 then manip_correct = manip_correct + 1;
if posmanipgwashington2 = 1 then manip_correct = manip_correct + 1;
if posmanipcouric1 = 1 then manip_correct = manip_correct + 1;
if posmanipcouric2 = 1 then manip_correct = manip_correct + 1;
if posmanipdimaggio1 = 1 then manip_correct = manip_correct + 1;
if posmanipdimaggio2 = 1 then manip_correct = manip_correct + 1;
if posmaniparmstrong1 = 1 then manip_correct = manip_correct + 1;
if posmaniparmstrong2 = 1 then manip_correct = manip_correct + 1;

if choicelennon1 = 1 then manip_correct = manip_correct + 1;
if choicelennon2 = 1 then manip_correct = manip_correct + 1;
if choiceirwin1= 1 then manip_correct = manip_correct + 1;
if choiceirwin2 = 1 then manip_correct = manip_correct + 1;
if choicebird1 = 1 then manip_correct = manip_correct + 1;
if choicebird2= 1 then manip_correct = manip_correct + 1;
if choicebird3= 1 then manip_correct = manip_correct + 1;
if choicekennedyonassis1 = 1 then manip_correct = manip_correct + 1;
if choiceredford1= 1 then manip_correct = manip_correct + 1;
if choiceredford2= 1 then manip_correct = manip_correct + 1;
if choicepitt1 = 1 then manip_correct = manip_correct + 1;
if choicepitt2 = 1 then manip_correct = manip_correct + 1;
if choicegwashington1 = 1 then manip_correct = manip_correct + 1;
if choicegwashington2 = 1 then manip_correct = manip_correct + 1;
if choicecouric1 = 1 then manip_correct = manip_correct + 1;
if choicecouric2 = 1 then manip_correct = manip_correct + 1;
if choicedimaggio1 = 1 then manip_correct = manip_correct + 1;
if choicedimaggio2 = 1 then manip_correct = manip_correct + 1;
if choicearmstrong1 = 1 then manip_correct = manip_correct + 1;
if choicearmstrong2 = 1 then manip_correct = manip_correct + 1;

if negmanipbundy1 = 1 then manip_correct = manip_correct + 1;
if negmanipbundy2 = 1 then manip_correct = manip_correct + 1;
if negmanipgotti1= 1 then manip_correct = manip_correct + 1;
if negmanipgotti2 = 1 then manip_correct = manip_correct + 1;
if negmanipmanson1 = 1 then manip_correct = manip_correct + 1;
if negmanipmanson2= 1 then manip_correct = manip_correct + 1;
if negmanipatkins1 = 1 then manip_correct = manip_correct + 1;
if negmanipatkins2 = 1 then manip_correct = manip_correct + 1;
if negmanipyates1= 1 then manip_correct = manip_correct + 1;
if negmanipyates2= 1 then manip_correct = manip_correct + 1;
if negmanipmcveigh1 = 1 then manip_correct = manip_correct + 1;
if negmanipmcveigh2 = 1 then manip_correct = manip_correct + 1;
if negmanipskilling1 = 1 then manip_correct = manip_correct + 1;
if negmanipskilling2 = 1 then manip_correct = manip_correct + 1;
if negmanipdahmer1 = 1 then manip_correct = manip_correct + 1;
if negmanipdahmer2 = 1 then manip_correct = manip_correct + 1;
if negmanipkaczynski1 = 1 then manip_correct = manip_correct + 1;
if negmanipkaczynski2 = 1 then manip_correct = manip_correct + 1;
if negmaniphitler1 = 1 then manip_correct = manip_correct + 1;
if negmaniphitler2 = 1 then manip_correct = manip_correct + 1;
if negmaniphitler3 = 1 then manip_correct = manip_correct + 1;
if negmaniphitler4 = 1 then manip_correct = manip_correct + 1;

if choicebundy1 = 1 then manip_correct = manip_correct + 1;
if choicebundy2 = 1 then manip_correct = manip_correct + 1;
if choicegotti1= 1 then manip_correct = manip_correct + 1;
if choicegotti2 = 1 then manip_correct = manip_correct + 1;
if choicemanson1 = 1 then manip_correct = manip_correct + 1;
if choicemanson2= 1 then manip_correct = manip_correct + 1;
if choiceatkins1 = 1 then manip_correct = manip_correct + 1;
if choiceatkins2 = 1 then manip_correct = manip_correct + 1;
if choiceyates1= 1 then manip_correct = manip_correct + 1;
if choiceyates2= 1 then manip_correct = manip_correct + 1;
if choicemcveigh1 = 1 then manip_correct = manip_correct + 1;
if choicemcveigh2 = 1 then manip_correct = manip_correct + 1;
if choiceskilling1 = 1 then manip_correct = manip_correct + 1;
if choiceskilling2 = 1 then manip_correct = manip_correct + 1;
if choicedahmer1 = 1 then manip_correct = manip_correct + 1;
if choicedahmer2 = 1 then manip_correct = manip_correct + 1;
if choicekaczynski1 = 1 then manip_correct = manip_correct + 1;
if choicekaczynski2 = 1 then manip_correct = manip_correct + 1;
if choicehitler1 = 1 then manip_correct = manip_correct + 1;
if choicehitler2 = 1 then manip_correct = manip_correct + 1;

if posmanipking1 = 1 then manip_correct = manip_correct + 1;
if posmanipking2 = 1 then manip_correct = manip_correct + 1;
if posmanipali1= 1 then manip_correct = manip_correct + 1;
if posmanipali2 = 1 then manip_correct = manip_correct + 1;
if posmanipmorrison1 = 1 then manip_correct = manip_correct + 1;
if posmanipmorrison2= 1 then manip_correct = manip_correct + 1;
if posmanipwoods1 = 1 then manip_correct = manip_correct + 1;
if posmanipwoods2 = 1 then manip_correct = manip_correct + 1;
if posmanipcosby1= 1 then manip_correct = manip_correct + 1;
if posmanipcosby2= 1 then manip_correct = manip_correct + 1;
if posmanipwinfrey1 = 1 then manip_correct = manip_correct + 1;
if posmanipwinfrey2 = 1 then manip_correct = manip_correct + 1;
if posmanipwashington1 = 1 then manip_correct = manip_correct + 1;
if posmanipwashington2 = 1 then manip_correct = manip_correct + 1;
if posmanipjordan1 = 1 then manip_correct = manip_correct + 1;
if posmanipjordan2 = 1 then manip_correct = manip_correct + 1;
if posmanipowens1 = 1 then manip_correct = manip_correct + 1;
if posmanipowens2 = 1 then manip_correct = manip_correct + 1;
if posmanipmandela1 = 1 then manip_correct = manip_correct + 1;
if posmanipmandela2 = 1 then manip_correct = manip_correct + 1;

if choiceking1 = 1 then manip_correct = manip_correct + 1;
if choiceking2 = 1 then manip_correct = manip_correct + 1;
if choiceali1= 1 then manip_correct = manip_correct + 1;
if choiceali2 = 1 then manip_correct = manip_correct + 1;
if choicemorrison1 = 1 then manip_correct = manip_correct + 1;
if choicemorrison2= 1 then manip_correct = manip_correct + 1;
if choicewoods1 = 1 then manip_correct = manip_correct + 1;
if choicewoods2 = 1 then manip_correct = manip_correct + 1;
if choicecosby1= 1 then manip_correct = manip_correct + 1;
if choicecosby2= 1 then manip_correct = manip_correct + 1;
if choicewinfrey1 = 1 then manip_correct = manip_correct + 1;
if choicewinfrey2 = 1 then manip_correct = manip_correct + 1;
if choicewashington1 = 1 then manip_correct = manip_correct + 1;
if choicewashington2 = 1 then manip_correct = manip_correct + 1;
if choicejordan1 = 1 then manip_correct = manip_correct + 1;
if choicejordan2 = 1 then manip_correct = manip_correct + 1;
if choiceowens1 = 1 then manip_correct = manip_correct + 1;
if choiceowens2 = 1 then manip_correct = manip_correct + 1;
if choicemandela1 = 1 then manip_correct = manip_correct + 1;
if choicemandela2 = 1 then manip_correct = manip_correct + 1;

if flowercarnation1 = 1 then manip_correct = manip_correct + 1;
if flowercarnation2 = 1 then manip_correct = manip_correct + 1;
if flowerrose1= 1 then manip_correct = manip_correct + 1;
if flowerrose2 = 1 then manip_correct = manip_correct + 1;
if flowertulip1 = 1 then manip_correct = manip_correct + 1;
if flowertulip2= 1 then manip_correct = manip_correct + 1;
if flowerhibiscus1 = 1 then manip_correct = manip_correct + 1;
if flowerhibiscus2 = 1 then manip_correct = manip_correct + 1;
if flowerpoppy1= 1 then manip_correct = manip_correct + 1;
if flowerpoppy2= 1 then manip_correct = manip_correct + 1;
if flowerlily1 = 1 then manip_correct = manip_correct + 1;
if flowerlily2 = 1 then manip_correct = manip_correct + 1;
if flowersunflower1 = 1 then manip_correct = manip_correct + 1;
if flowersunflower2 = 1 then manip_correct = manip_correct + 1;
if flowerdaisy1 = 1 then manip_correct = manip_correct + 1;
if flowerdaisy2 = 1 then manip_correct = manip_correct + 1;
if flowerorchid1 = 1 then manip_correct = manip_correct + 1;
if flowerorchid2 = 1 then manip_correct = manip_correct + 1;
if floweriris1 = 1 then manip_correct = manip_correct + 1;
if floweriris2 = 1 then manip_correct = manip_correct + 1;

if choicecarnation1 = 1 then manip_correct = manip_correct + 1;
if choicecarnation2 = 1 then manip_correct = manip_correct + 1;
if choicerose1= 1 then manip_correct = manip_correct + 1;
if choicerose2 = 1 then manip_correct = manip_correct + 1;
if choicetulip1 = 1 then manip_correct = manip_correct + 1;
if choicetulip2= 1 then manip_correct = manip_correct + 1;
if choicehibiscus1 = 1 then manip_correct = manip_correct + 1;
if choicehibiscus2 = 1 then manip_correct = manip_correct + 1;
if choicepoppy1= 1 then manip_correct = manip_correct + 1;
if choicepoppy2= 1 then manip_correct = manip_correct + 1;
if choicelily1 = 1 then manip_correct = manip_correct + 1;
if choicelily2 = 1 then manip_correct = manip_correct + 1;
if choicesunflower1 = 1 then manip_correct = manip_correct + 1;
if choicesunflower2 = 1 then manip_correct = manip_correct + 1;
if choicedaisy1 = 1 then manip_correct = manip_correct + 1;
if choicedaisy2 = 1 then manip_correct = manip_correct + 1;
if choiceorchid1 = 1 then manip_correct = manip_correct + 1;
if choiceorchid2 = 1 then manip_correct = manip_correct + 1;
if choiceiris1 = 1 then manip_correct = manip_correct + 1;
if choiceiris2 = 1 then manip_correct = manip_correct + 1;

if insectant1 = 1 then manip_correct = manip_correct + 1;
if insectant2 = 1 then manip_correct = manip_correct + 1;
if insectbee1= 1 then manip_correct = manip_correct + 1;
if insectbee2 = 1 then manip_correct = manip_correct + 1;
if insectgrasshopper1 = 1 then manip_correct = manip_correct + 1;
if insectgrasshopper2= 1 then manip_correct = manip_correct + 1;
if insectprayingmantis1 = 1 then manip_correct = manip_correct + 1;
if insectprayingmantis2 = 1 then manip_correct = manip_correct + 1;
if insectbutterfly1= 1 then manip_correct = manip_correct + 1;
if insectbutterfly2= 1 then manip_correct = manip_correct + 1;
if insectmosquito1 = 1 then manip_correct = manip_correct + 1;
if insectmosquito2 = 1 then manip_correct = manip_correct + 1;
if insectbeetle1 = 1 then manip_correct = manip_correct + 1;
if insectbeetle2 = 1 then manip_correct = manip_correct + 1;
if insectcockroach1 = 1 then manip_correct = manip_correct + 1;
if insectcockroach2 = 1 then manip_correct = manip_correct + 1;
if insectdragonfly1 = 1 then manip_correct = manip_correct + 1;
if insectdragonfly2 = 1 then manip_correct = manip_correct + 1;
if insectcentipede1 = 1 then manip_correct = manip_correct + 1;
if insectcentipede2 = 1 then manip_correct = manip_correct + 1;

if choiceant1 = 1 then manip_correct = manip_correct + 1;
if choiceant2 = 1 then manip_correct = manip_correct + 1;
if choicebee1= 1 then manip_correct = manip_correct + 1;
if choicebee2 = 1 then manip_correct = manip_correct + 1;
if choicegrasshopper1 = 1 then manip_correct = manip_correct + 1;
if choicegrasshopper2= 1 then manip_correct = manip_correct + 1;
if choiceprayingmantis1 = 1 then manip_correct = manip_correct + 1;
if choiceprayingmantis2 = 1 then manip_correct = manip_correct + 1;
if choicebutterfly1= 1 then manip_correct = manip_correct + 1;
if choicebutterfly2= 1 then manip_correct = manip_correct + 1;
if choicemosquito1 = 1 then manip_correct = manip_correct + 1;
if choicemosquito2 = 1 then manip_correct = manip_correct + 1;
if choicebeetle1 = 1 then manip_correct = manip_correct + 1;
if choicebeetle2 = 1 then manip_correct = manip_correct + 1;
if choicecockroach1 = 1 then manip_correct = manip_correct + 1;
if choicecockroach2 = 1 then manip_correct = manip_correct + 1;
if choicedragonfly1 = 1 then manip_correct = manip_correct + 1;
if choicedragonfly2 = 1 then manip_correct = manip_correct + 1;
if choicecentipede1 = 1 then manip_correct = manip_correct + 1;
if choicecentipede2 = 1 then manip_correct = manip_correct + 1;
run;

data web_out.clean_explicit_all; set web_out.clean_explicit_all;
DROP 
Tblack
Twhite
attrace
ageeinsteinb
posmanipkinga
posmanipkingb
posmanipwoodsa
posmanipwoodsb
posmanipowensa
posmanipowensb
posmanipmandelaa
posmanipmandelab
posmanipmorrisona
posmanipmorrisonb
posmanipwinfreya
posmanipwinfreyb
posmanipwashingtona
posmanipwashingtonb
posmanipcosbya
posmanipcosbyb
posmanipalia
posmanipalib
posmanipjordana
posmanipjordanb
choicekinga
choicekingb
choicewoodsa
choicewoodsb
choiceowensa
choiceowensb
choicemandelaa
choicemandelab
choicemorrisona
choicemorrisonb
choicewinfreya
choicewinfreyb
choicewashingtona
choicewashingtonb
choicecosbya
choicecosbyb
choicealia
choicealib
choicejordana
choicejordanb
posmanipirwina
posmanipirwinb
posmanipbirda
posmanipbirdb
posmanipkennedyonass
posmanipredforda
posmanipredfordb
posmanippitta
posmanippittb
posmanipgwashingtona
posmanipgwashingtonb
posmanipcourica
posmanipcouricb
posmaniplennona
posmaniplennonb
posmanipdimaggioa
posmanipdimaggiob
posmaniparmstronga
posmaniparmstrongb
choiceirwina
choiceirwinb
choicebirda
choicebirdb
choicekennedyonassis
choiceredforda
choiceredfordb
choicepitta
choicepittb
choicegwashingtona
choicegwashingtonb
choicecourica
choicecouricb
choicelennona
choicelennonb
choicedimaggioa
choicedimaggiob
choicearmstronga
choicearmstrongb
negmanipgottia
negmanipgottib
negmanipdahmera
negmanipdahmerb
negmaipdahmerb
negmanipmansona
negmanipmansonb
negmanipmcveigha
negmanipmcveighb
negmanipskillinga
negmanipskillingb
negmanipatkinsa
negmanipatkinsb
negmanipyatesa
negmanipyatesb
negmanipkaczynskia
negmanipkaczynskib
negmanipbundya
negmanipbundyb
negmaniphitlera
negmaniphitlerb
choicegottia
choicegottib
choicedahmera
choicedahmerb
choicemansona
choicemansonb
choicemcveigha
choicemcveighb
choiceskillinga
choiceskillingb
choiceatkinsa
choiceatkinsb
choiceyatesa
choiceyatesb
choicekaczynskia
choicekaczynskib
choicebundya
choicebundyb
choicehitlera
choicehitlerb
choicehiltera
choicehilterb
flowerhibiscusa
flowerhibiscusb
flowerdaisya
flowerdaisyb
flowerlilya
flowerlilyb
flowerosea
flowerrosea
flowerroseb
flowersunflowera
flowersunflowerb
flowerorchida
flowerorchidb
flowertulipa
flowertulipb
flowercarnationa
flowercarnationb
floweririsa
floweririsb
flowerpoppya
flowerpoppyb
choicehibiscusa
choicehibiscusb
choicedaisya
choicedaisyb
choicelilya
choicelilyb
choicerosea
choiceroseb
choicesunflowera
choicesunflowerb
choiceorchida
choiceorchidb
choicetulipa
choicetulipb
choicecarnationa
choicecarnationb
choiceirisa
choiceirisb
choicepoppya
choicepoppyb
insectanta
insectantb
insectprayingmantisa
insectprayingmantisb
insectbeea
insectbeeb
insectbutterflya
insectbutterflyb
insectbeetlea
insectbeetleb
insectcockroacha
insectcockroachb
insectcentipedea
insectcentipedeb
insectgrasshoppera
insectgrasshopperb
insectmosquitoa
insectmosquitob
insectdragonflya
insectdragonflyb
choiceanta
choiceantb
choiceprayingmantisa
choiceprayingmantisb
choicebeea
choicebeeb
choicebutterflya
choicebutterflyb
choicebeetlea
choicebeetleb
choicecockroacha
choicecockroachb
choicecentipedea
choicecentipedeb
choicegrasshoppera
choicegrasshopperb
choicemosquitoa
choicemosquitob
choicedragonflya
choicedragonflyb;
run;


/********************************************************/
/*               Looking at Order effects               */
/********************************************************/
proc sort data = web_in.sessiontasks; 
by session_id task_url; 
data web_out.taskorder; set web_in.sessiontasks;
repeat=0;
     if session_id = lag(session_id) and task_url = lag(task_url)
        then repeat=1; *if prior row is same as current row, mark as a repeat;
proc freq; tables repeat; run; 
data web_out.taskorder; set web_out.taskorder;
    	 if repeat = 1 then delete; drop repeat; run; *drop duplicate lines of data;

proc freq data = web_out.taskorder;
tables task_url;
run;

data web_out.taskorder; set web_out.taskorder;
 *tranwrd looks for the first string in quotes and replaces it with the second string in quotes;
 task_url = tranwrd(task_url,"/common/en-us/html/IATTask.jsp?i=/implicit/user/","");
 task_url = tranwrd(task_url,".html","");
 task_url = tranwrd(task_url,"//user/jenniferjoy/brockfollowup/","");
 task_url = tranwrd(task_url,"/user/education/","");
 task_url = tranwrd(task_url,".xml&","");
 task_url = tranwrd(task_url,".jsp","");
 task_url = tranwrd(task_url,".xml","");
 task_url = tranwrd(task_url,"education/race/","");
 task_url = tranwrd(task_url,"/common/en-us/html/","");
run;

proc sort;
by session_id;
run;
proc means;
class task_url;
var task_number;
run;
proc transpose data = web_out.taskorder out = web_out.clean_task_order; 
by session_id;
id task_url; 
var task_number; 
run;

data web_out.clean_task_order; set web_out.clean_task_order;
if explicit = 44 then do;
   IEorder = 1;
end;
else if  explicit = 46 then do;
   IEorder = 2;
end;
run;

*IEorder = 1 means explicit first;
*IEorder = 2 means implicit first;


/********************************************************/
/*   Merging session with task (to get session_status)  */
/********************************************************/
data web_out.sessions; set web_in.sessions;
KEEP 
session_id
session_status
user_id;
run;
proc sort;
by session_id;
run;
proc sort data = web_out.clean_task_order;
by session_id;
run;

data web_out.clean_task_order;
merge web_out.sessions web_out.clean_task_order;
by session_id;
run;


/********************************************************/
/*              Merging demo with task_order            */
/********************************************************/

proc sort data=web_in.demo;
by user_id;
run;

proc transpose data = web_in.demo out = web_out.demo_clean; 
by user_id;
id characteristic; 
var value; 
run;

proc sort data=web_out.clean_task_order; by user_id;run;
proc sort data=web_out.demo_clean; by user_id;run;
data web_out.final_task_order;
merge web_out.clean_task_order web_out.demo_clean;
by user_id;
drop _NAME_;
run;

data web_out.final_task_order; set web_out.final_task_order;
birthmonth1 = birthmonth * 1;
birthyear1 = birthyear * 1;
education1 = education * 1;
engfluency1 = engfluency * 1;
ethnicityomb1 = ethnicityomb * 1;
raceomb1 = raceomb * 1;
if sex = 'f' then sex1 = 0;
if sex = 'm' then sex1 = 1;
politicalid1 = politicalid * 1;
major1 = major * 1;
religionid1 = religionid * 1;
age = 2008 - birthyear1;

drop birthmonth birthyear education engfluency ethnicityomb religionid major1;
run;
PROC FREQ;
TABLES raceomb1;
RUN;

data web_out.final_task_order; set web_out.final_task_order;
KEEP
session_id
session_status
user_id
birthmonth1
birthyear1
education1
engfluency1
ethnicityomb1 
raceomb1 
sex1
politicalid1 
religionid1 
age
IEorder;
run;

/********************************************************/
/*   Merging final session info (to get condition)      */
/********************************************************/
proc sort data = web_out.final_task_order;
by session_id;
run;
data web_out.sessioninfo_final; set web_out.sessioninfo;
KEEP
session_id
condition;
run;
data web_out.final_task_order;
merge web_out.final_task_order web_out.sessioninfo_final;
by session_id;
run;

/********************************************************/
/*           DOING FINAL SORT OF ALL FILES              */
/********************************************************/
data race.raceiat;
merge 	race.race_iat_clean
		race.pairing(rename=(PB3=RPB3 PB4=RPB4 PB6=RPB6 PB7=RPB7))
		race.ns(rename=(NB3=RNB3 NB4=RNB4 NB6=RNB6 NB7=RNB7));by session_id;
raceiat = IAT;
REB3 = EB3;
REB4 = EB4;
REB6 = EB6;
REB7 = EB7;
R_exclude = subexcl;
keep raceiat session_id REB3 REB4 REB6 REB7 RNB3 RNB4 RNB6 RNB7 RPB3 RPB4 RPB6 RPB7 R_exclude;
proc sort;
by session_id;
run;
data final_race_iat; set race.raceiat;
run;

proc sort
data = final_race_iat;
by session_id;
run;
proc sort data=web_out.clean_explicit_all;
by session_id;
run;
proc sort
data = web_out.final_task_order;
by session_id;
run;


proc contents data=final_race_iat;run;
proc contents data=web_out.clean_explicit_all;run;
proc contents data=web_out.final_task_order;run;

/********************************************************/
/*           MERGING ALL DATA TOGETHER                  */
/********************************************************/
data web_out.final;
merge final_race_iat web_out.clean_explicit_all web_out.final_task_order;
by session_id;
run;
proc contents data = web_out.final;
run;


/********************************************************/
/*    CHECKING TO MAKE SURE MISSING DATA IS EXPECTED    */
/********************************************************/
proc means data=web_out.final missing; *We have none in the data;
class _ourip;
var session_id;
run;
proc means data=web_out.final missing;
class study_name;
var session_id;
run;
proc means data=web_out.final missing;
class Condition;
var session_id;
run;


/********************************************************/
/*             DROPPING SS WHO DIDN'T GET A 0           */
/********************************************************/
data web_out.newfinal; set web_out.final;
if R_exclude ne 0 then raceiat = .;
run;

/********************************************************/
/*         EXAMINING PEOPLE WHO GOT TO VERY END         */
/********************************************************/
data web_out.lefin; set web_out.newfinal;
if session_status ne 'C' then delete;
run;

proc freq data = web_out.lefin;
tables condition;
run;

*condition 1 = 442;
*condition 2 = 371;
*condition 3 = 387;


/********************************************************/
/*     EXAMINING WHO GOT >=30 MANIPULATIONS CORRECT      */
/********************************************************/
data web_out.mancheck; set web_out.lefin;
where manip_correct >= 30;
if politicalid1 = 1 then newpolitical = 1;
if politicalid1 = 2 then newpolitical = 1;
if politicalid1 = 3 then newpolitical = 1;
if politicalid1 = -1 then newpolitical = 0;
if politicalid1 = -2 then newpolitical = 0;
if politicalid1 = -3 then newpolitical = 0;
if politicalid1 = 0 then newpolitical = 3;
if condition = 1 then newcon = 1;
if condition = 2 then newcon = 2;
if condition = 3 then nnewcon = 3;
if condition = 2 then nnewcon = 2;
if condition = 1 then nnnewcon = 1;
if condition = 3 then nnnewcon = 2;
newattrace1 = attrace1 - 4;
run;

proc freq data = web_out.mancheck;
tables condition;
run;

*condition 1 = 436;
*condition 2 = 370;
*condition 3 = 385;

/***************************************************/
/* THERE ARE FOUR FINAL DATA SETS                  */
/* 1) final - raw data with nobody dropped         */
/* 2) newfinal - ss with IATs /= 0 dropped         */
/* 3) lefin - ss not getting a C for the study     */
/* 4) mancheck - only ss >=30 manip questions right*/
/***************************************************/



/********************************************************/
/*                   DEMOGRAPHICS                       */
/********************************************************/


proc freq data = web_out.mancheck;
tables condition;
run;
proc means data = web_out.mancheck;
class condition;
var raceiat;
where IEorder = 2;
run;
proc means data = web_out.final(where=(session_status='C'));
var session_id;
run;

*Getting general information about all variables;
proc univariate plot data = web_out.mancheck;
var age religionid1 politicalid1 Tblack1 Twhite1;
run;

*Getting general information about IATs and number correct for manipulations;
proc univariate plot data = web_out.mancheck;
class condition;
var raceiat manip_correct;
run;

proc means data = web_out.mancheck;
class condition;
var raceiat attrace1;
run;

proc ttest data=web_out.mancheck H0 = 0;
var raceiat;
run; 

/********************************************************/
/*                   Looking at means                   */
/********************************************************/
*Means for participbees on the IAT;
proc means data = web_out.mancheck;
class R_exclude;
var raceiat;
run;

*Looking at the correlation between explicit and implicit;
proc sort data = web_out.mancheck;
by condition;
run;
ods html;
proc corr data = web_out.mancheck;
var raceiat attrace1;
run;
ods html close;

proc means n mean std stderr data = web_out.mancheck;
class condition;
var raceiat;
where IEorder = 2;
run;

proc ttest data = web_out.mancheck;
paired Twhite1*Tblack1;
run;

proc means n mean std stderr data = web_out.mancheck;
class condition;
var attrace1;
where IEorder = 2;
run;

PROC FREQ DATA = web_out.mancheck;
TABLES raceomb1;
RUN;

proc glm data = web_out.mancheck;
model newattrace1 = IEorder/ ss3;
run;
proc glm data = web_out.mancheck;
model newattrace1 = condition / ss3;
contrast 'Treatment versus vs. Control' condition -1 -1 2;
run;
proc ttest data=web_out.mancheck;
class nnewcon;
var newattrace1;
run; 

proc ttest data=web_out.mancheck;
class newcon;
var raceiat;
run; 

*Condition 1 = Neg/pos manipulation;
*Condition 2 = Pos/pos manipulation;
*Condition 3 = Control manipulation;

